﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>员工面板</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />

<script src="../../scripts/boot.js" type="text/javascript"></script>


<style type="text/css">
html, body {
	padding: 0;
	margin: 0;
	border: 0;
	height: 100%;
	overflow: hidden;
}
</style>
</head>
<body>

	<form id="form1" id="orderForm" method="post">
		<!--<input name="oldid" class="mini-hidden" 不是流水号改/>-->
		<input name="oldid" class="mini-hidden" />
		<div style="padding-left: 11px; padding-bottom: 5px;">
			<table style="table-layout: fixed;">
				<tr>
					<td style="display: none; width: 80px;">编号</td>
					<td style="display: none; width: 150px;"><input name="id"
						class="mini-textbox" required="true" emptyText="订单编号" /></td>
					
					
                <td style="display: none; width: 150px;">理发师编号</td>
            	<td style="display: none; width: 150px;">
                	<input name="barberid" class="mini-combobox" valueField="id" textField="username"
						   url="../../order/getAllBarber" required="true" emptyText="请选择课题类别"/>
                </td>
						<!--<td><input name="barberid" class="mini-textbox"
						required="true" /></td> -->
					<!--<td style="width:150px;">    -->
					<!--<input name="name" class="mini-combobox" valueField="id" textField="name"-->
					<!--url="../data/AjaxService1.jsp?method=GetDepartments"-->
					<!--onvaluechanged="onDeptChanged" required="true"-->
					<!--emptyText="请选择部门"-->
					<!--/>-->
					<!--</td>-->
				</tr>
				<tr>
					<td style="display: none; width: 150px;">顾客编号</td>
					<td style="display: none; width: 150px;"><input name="customerid" class="mini-textbox"
						required="true" /></td>
					<td>状态：</td>
					<td><select name="status" class="mini-radiobuttonlist">
							<option value="0">预定</option>
						<option value="1">进行中</option>
						<option value="2">理发完成</option>
						<option value="3">取消预约</option>
					</select></td>


				</tr>

				<tr>
					<td >开始时间</td>
					<td><input name="begintime" class="mini-datepicker" showTime="true"
						required="true" emptyText="请选择日期" /></td>
					<td>结束时间</td>
					<td>
						<input name="endtime" class="mini-datepicker" showTime="true"
						required="true" emptyText="请选择日期" /></td>
					<td style="display: none; width: 150px;">发型</td>
					<td style="display: none; width: 150px;">
					<input name="styleid" class="mini-textbox"
						required="true" /> <!--<td style="width:150px;">--> <!--<input name="styleid" class="mini-combobox" valueField="id" textField="name"-->
						<!--url="../data/AjaxService.jsp?method=GetDepartments"--> <!--onvaluechanged="onDeptChanged" required="true"-->
						<!--emptyText="请选择部门"--> <!--/>--></td>
				</tr>
			</table>
		</div>

		<div style="text-align: center; padding: 10px;">
			<a class="mini-button" onclick="onOk"
				style="width: 60px; margin-right: 20px;">确定</a> <a
				class="mini-button" onclick="onCancel" style="width: 60px;">取消</a>
		</div>
	</form>
	<script type="text/javascript">
        mini.parse();


        var form = new mini.Form("form1");// new  FormData()


        function SaveData() {
            var o = form.getData();

            form.validate();
            if (form.isValid() == false) return;

            var json = mini.encode([o]);
            console.log(json)//向控制台
            if (method == "insert") {
                $.ajax({
                    url: "../../order/insert",//增加 date 里面style 是因为         style.html 里面var style = { action: "new"};

                    // type: 'post',
                    // data: {order: json},
                    contentType: 'application/json',//新
                    type: 'post',
                    data: JSON.stringify(o),

                    cache: false,
                    success: function (text) {
                        CloseWindow("save");
                    },
                    error: function (jqXHR, textStatus, errorThrown) {
                        alert(jqXHR.responseText);
                        CloseWindow();
                    }
                });
            }
            else {
                $.ajax({
                    url: "../../order/update",

                    contentType: 'application/json',//新
                    type: 'post',
                    data: JSON.stringify(o),
                    // type: 'post',
                    // data: {order: json},
                    cache: false,
                    success: function (text) {
                        CloseWindow("save");
                    },
                    error: function (jqXHR, textStatus, errorThrown) {
                        alert(jqXHR.responseText);
                        CloseWindow();
                    }
                });
            }
        }

            //////////////////
            // 标准方法接口定义
            function SetData(data) {
                method = data.action
                if (data.action == "update" ) {

                    //跨页面传递的数据对象，克隆后才可以安全使用
                    data = mini.clone(data);
                    var orderdata = data.orderdata
                    console.log(orderdata)
                    console.log(typeof orderdata)//字符串
                    orderdata = JSON.parse(orderdata)
                    form.setData(orderdata)
                }
            }

            function GetData() {
                var o = form.getData();
                return o;
            }

            function CloseWindow(action) {
                if (action == "close" && form.isChanged()) {
                    if (confirm("数据被修改了，是否先保存？")) {
                        return false;
                    }
                }
                if (window.CloseOwnerWindow) return window.CloseOwnerWindow(action);
                else window.close();
            }

            function onOk(e) {
                SaveData();
                //UpSaveData();
                // SetData();
            }

            function onCancel(e) {
                CloseWindow("cancel");
            }

            //////////////////////////////////



    </script>
</body>
</html>
